Modifier and Type | Field and Description |
---|---|
private String |
errors
Variable for recording a possible error that may occur during the parsing process
|
private StringBuffer |
warnings
Variable for recording possible warnings that can occur during the parsing process
|
protected static URI |
XES_URI
Unique URI for the format definition.
|
private XFactoryBufferedImpl |
xesFactory
Utility object for creating an XLog and its elements
|
private XsDateTimeConversionJava7 |
xsDateTimeConverter
Utility object for data conversion, from a date expressed in
some natural form, to a date expressed in the XES standard.
|
Constructor and Description |
---|
CsvXesParser()
Constructs a
CsvXesParser , ready to use. |
Modifier and Type | Method and Description |
---|---|
String |
author()
Returns the name of the author of this parser.
|
boolean |
canParse(File file)
Checks whether this parser can handle the given file
|
String |
description()
Returns a brief description of this parser.
|
private void |
generateXLogs(com.opencsv.CSVReader reader,
List<XLog> logList,
int line)
This method first starts reading the file from top to bottom searching for the first line
with some text.
|
String |
getErrors()
This method returns the possible error happened during the parsing process.
|
String |
getWarnings()
This method returns the possibile warning list recorded during the parsing process.
|
String |
name()
Returns the name of this parser or, more specifically, the name of the format it can process.
|
List<XLog> |
parse(File file)
Parses the given file in a CSV format, and returns the XLog instances extracted.
|
List<XLog> |
parse(InputStream is)
Parses a log from the given input stream in a CSV format, and returns the XLog instances extracted.
|
endsWithIgnoreCase, toString
protected static final URI XES_URI
private XsDateTimeConversionJava7 xsDateTimeConverter
XsDateTimeConversionJava7
private XFactoryBufferedImpl xesFactory
XFactoryBufferedImpl
private StringBuffer warnings
StringBuffer
private String errors
public String author()
public String description()
description
in class XParser
public String name()
public String getWarnings()
String
representing the warning list recorded during the parsing process.public String getErrors()
String
representing the error happened during the parsing process.public boolean canParse(File file)
public List<XLog> parse(File file) throws Exception
The file is first checked against this parser, to check whether it can be handled.
If the parser cannot handle the given file, or the extraction itself fails, the parser should raise an IOException.
public List<XLog> parse(InputStream is) throws Exception
parse
in class XParser
is
- Stream to read XLog instances fromException
- Raised in case the parser fails, or the given file cannot be processed.private void generateXLogs(com.opencsv.CSVReader reader, List<XLog> logList, int line) throws Exception
After it has read the column line correctly and defined the column names, the method reads all the remaining lines (every line of the CSV document represents an event and its attributes), skipping the empty ones, taking the first line value as the trace id to which the event belongs and the remaining values of the line as the event values for the attributes defined by the column names.
At the end of the process, the method adds the generated XLog to the collection and if there is another log in the CSV to translate, it starts again to analyse this other log.
The method manages empty values as the absence of that attribute for the scanned event and discards the exceeding values (if a line has more values than the column names).
reader
- the opened CSVReader
over the CSV documentto use for reading the filelogList
- the List
of XLog
where to add the generated logline
- the line from which to start analysing (the first time this value is 0, the top of the document,
then it assumes the values of the line where a new log in the CSV document starts)Exception
- possible exceptions thrown by the CSVReader